Various embodiments of this disclosure relate to dispatching function calls in a computer system and, more particularly, to dispatching function calls across devices.
During execution of a program, one or multiple function calls may be made. Function calls alter a program state by switching execution context and allocating frames on a dedicated stack, usually referred to as “call stack.”
Generally, when a function is called during execution of a program, parameters of the call are saved onto a current stack frame, a program counter is saved into a link register, and the program branches to the address corresponding to the called function's code. The called function then allocates a stack frame on top of the previous stack frame and uses the new stack frame as its execution context. The called function accesses its parameters from the stack frame of the caller. When the called function returns, the return value is saved onto the stack frame of the caller. The called function's stack frame is removed, and the program branches to the address contained in the link register. The caller accesses the return value from its own stack frame.